/* eslint-env node */
module.exports = {
  root: true,
  plugins: ['node', 'promise', 'import'],
  extends: ['airbnb-base', 'airbnb-typescript/base'],
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: ['./tsconfig.json'],
  },
  rules: {
    'max-len': ['error', { code: 140 }],
    indent: ['error', 2],
    semi: ['error', 'never'],
    quotes: ['error', 'single'],
    'comma-dangle': ['error', 'always-multiline'],
    'object-curly-spacing': ['error', 'always'],
    'arrow-parens': ['error', 'always'],
    'linebreak-style': ['error', 'unix'],
    'operator-linebreak': ['error', 'before'],
    'no-underscore-dangle': ['error', { allow: ['_id', '_db', '_primaryKey', '_ctx', '_tableName', '_'] }],
    radix: ['error', 'as-needed'],
    'sort-imports': ['error', { ignoreDeclarationSort: true }],
    'no-debugger': 'error',
    'no-console': 'error',
    'no-new': 'off',
    'no-continue': 'off',
    'no-await-in-loop': 'off',
    'no-unused-vars': 'warn',
    'no-restricted-syntax': 'warn',
    'no-param-reassign': 'off',
    'prefer-destructuring': 'off',
    'class-methods-use-this': 'off',
    'max-classes-per-file': 'off',
    'ts-nocheck': 'off',
    'import/order': ['error', {
      alphabetize: { order: 'asc' },
      'newlines-between': 'always',
      groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
      warnOnUnassignedImports: true,
    }],
    'import/no-extraneous-dependencies': 'off',
    'import/no-dynamic-require': 'off',
    'import/no-cycle': 'error',
    'import/prefer-default-export': 'off',
    '@typescript-eslint/lines-between-class-members': 'off',
    '@typescript-eslint/type-annotation-spacing': ['error', { before: false, after: true }],
    '@typescript-eslint/semi': ['error', 'never'],
  },
}
